﻿#ifndef THEOPENDEVICEDISCOVERLISTMODEL_H
#define THEOPENDEVICEDISCOVERLISTMODEL_H

#include <QAbstractListModel>
class MyData{
public:
    MyData(QString s):m_ipaddandport(s){

    }
    QString m_ipaddandport;
    //int flag;//状态
};
class TheOpenDeviceDiscoverListModel : public QAbstractListModel
{
    Q_OBJECT

public:
    enum Content{
        Theipaddandport = Qt::DisplayRole,
        //TheState
    };

    void infoAppending(QString str);

    static TheOpenDeviceDiscoverListModel* instance();

    explicit TheOpenDeviceDiscoverListModel(QObject *parent = nullptr);

    virtual QHash<int,QByteArray> roleNames() const override;

    // Basic functionality:
    int rowCount(const QModelIndex &parent = QModelIndex()) const override;

    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;

private:
    QList<MyData> m_data;
};

#endif // THEOPENDEVICEDISCOVERLISTMODEL_H
